﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Gnosis.Babel;

namespace Gnosis.SQLite
{
    public class Literal
        : Value
    {
        public Literal(object value)
            : base(GetLiteralString(value))
        {
        }

        private static string GetLiteralString(object value)
        {
            if (value == null)
                return "NULL";

            if (value.GetType() == typeof(string))
                return string.Format("'{0}'", value);

            if (value.GetType() == typeof(System.DateTime))
                return string.Format("'{0:s}'", value);

            return value.ToString();
        }
    }
}
